Skip to content

Conversation

AdamGrzybkowski
Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski commented Oct 17, 2025

WOOMOB-1516

Description

This PR implements the attendance_status we get from the API. This value is now displayed and also update after selecting an option from the bottom sheet.

For the loading progress indicator, I've decided to use the SkeletonView (see the recording below).

Only the bookings created after installing the latest plugin will have the status set. The old one will have an empty string. I didn't handle this in any way as this should be an issue for us during the development phase. But if you think we should, let me know.

Steps to reproduce

  1. Make sure to install the latest Booking plugin from trunk
  2. Create some new bookings
  3. Login to the app
  4. Go to bookings tab
  5. All the old bookings created before the plugin update will have an empty
  6. New bookings (from step 2) should have the booked status shown
  7. Open the booking
  8. Tap on the attendance Status row
  9. Select a new status
  10. Verify the status was updated

Testing information

Test network connection issues and response errors.

The tests that have been performed

The above

Images/gif

Screen_recording_20251017_151920.mp4
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@dangermattic
Copy link
Collaborator

dangermattic commented Oct 17, 2025

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Implements booking attendance status end-to-end: persistence, mapping, network update, UI display, and update-in-progress skeleton states.

  • Adds attendanceStatus to BookingEntity with Room converters and DB auto-migration.
  • Maps API field attendance_status to domain/UI, exposes updateAttendanceStatus via repository/store/client.
  • Updates UI to display attendance status, handle update via bottom sheet, and show SkeletonView while updating.

Reviewed Changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/persistence/entity/BookingEntity.kt Adds AttendanceStatus sealed type, field on entity, and type converters.
libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/persistence/WCAndroidDatabase.kt Bumps DB version and adds auto-migration for new column.
libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsRestClient.kt Adds endpoint to update attendance status.
libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsStore.kt Adds flow to call REST client, map DTO, and persist updated booking.
libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingDto.kt Adds attendance_status field to DTO.
libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingDtoMapper.kt Maps attendance_status to entity.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/BookingsRepository.kt Exposes updateAttendanceStatus to app layer.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/BookingMapper.kt Maps entity attendance to UI, threads update-in-progress state.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/details/* Wires selection to repository, tracks AttendanceUpdateStatus, updates state.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/compose/* Renders attendance tag/section with Skeleton during updates; updates enums → sealed types.
WooCommerce/src/main/res/values/strings.xml Adds error string for attendance status updates.
WooCommerce/src/test/* Adjusts tests for new API and verifies update call.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 158 to 160
val orderResult = bookingDto.orderId.takeIf { it != 0L }?.let {
orderStore.fetchSingleOrderSync(site, bookingDto.orderId)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed - asked here p1760707694187709/1760706907.922799-slack-CNA89KY6M

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answer is that the Order won't change, so I can update this to not make the extra request and only update the attendance status in the DB. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree. Given this update doesn't have any impact on the associated order I'd refrain from making that extra request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here - 3216cca

val parentId: Long,
val personCounts: List<Long>?,
val localTimezone: String,
@ColumnInfo(defaultValue = "") val attendanceStatus: AttendanceStatus,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this, as a default okay? All new bookings start with booked so we could do the same 🤔

Copy link
Contributor

@JorgeMucientes JorgeMucientes Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, would that mean that for bookings created prior to adding the attendance_status change to the API, we'd be setting it to booked?
What is wp-admin doing for old bookings that didn't have attendance_status set? I think we might simply want to leave it empty or null and avoid displaying any label or text when we don't have any real value.
If a default value is to be added for old bookings, then I think it should be the backend doing so not us.
WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, would that mean that for bookings created prior to adding the attendance_status change to the API, we'd be setting it to booked?

Correct, that's probably not good.

What is wp-admin doing for old bookings that didn't have attendance_status set?

Good question, I will try to find it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, would that mean that for bookings created prior to adding the attendance_status change to the API, we'd be setting it to booked?

Given there are no CIAB production users, I think this should be fine 🤔

The plugin seems to be using booked by default even for existing bookings as can be seen in L31 of class-wc-booking.php.

But for this special case, I think not setting a default is safest, we refresh the bookings each time they are open, so it's better to avoid hardcoding a default that can be changed by the plugin anytime, and hiding the value while we fetch the new value should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we might simply want to leave it empty or null and avoid displaying any label or text when we don't have any real value.

I've done that for now - updated in d4e83cc

Comment on lines +116 to +127
BookingEntity.AttendanceStatus.Booked -> BookingAttendanceStatus.Booked
BookingEntity.AttendanceStatus.CheckedIn -> BookingAttendanceStatus.CheckedIn
BookingEntity.AttendanceStatus.NoShow -> BookingAttendanceStatus.NoShow
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see, there's no Cancelled here - not sure yet how we will determine such attendance status.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to hide the AttendanceStatus when the booking is cancelled p1759237996387569/1759139627.152819-slack-C09224W4HAA

So it means there is no need for a Cancelled attendance status 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest moving this discussion to Slack to increase visibility and reach a final decision for both platforms.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 17, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitaac8045
Direct Downloadwoocommerce-wear-prototype-build-pr14778-aac8045.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 17, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitaac8045
Direct Downloadwoocommerce-prototype-build-pr14778-aac8045.apk

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2025

Codecov Report

❌ Patch coverage is 14.47964% with 189 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.03%. Comparing base (1a0e8ca) to head (aac8045).

Files with missing lines Patch % Lines
.../ui/bookings/compose/BookingAttendanceStatusTag.kt 0.00% 47 Missing ⚠️
...id/ui/bookings/compose/BookingAttendanceSection.kt 0.00% 43 Missing ⚠️
...erce/android/ui/bookings/compose/BookingSummary.kt 7.69% 24 Missing ⚠️
...xc/network/rest/wpcom/wc/bookings/BookingsStore.kt 0.00% 23 Missing ⚠️
...oid/ui/bookings/details/BookingDetailsViewModel.kt 48.27% 5 Missing and 10 partials ⚠️
...ings/compose/BookingAttendanceStatusBottomSheet.kt 0.00% 10 Missing ⚠️
...twork/rest/wpcom/wc/bookings/BookingsRestClient.kt 0.00% 10 Missing ⚠️
...commerce/android/ui/bookings/BookingsRepository.kt 0.00% 8 Missing ⚠️
.../android/fluxc/persistence/entity/BookingEntity.kt 58.33% 2 Missing and 3 partials ⚠️
...m/woocommerce/android/ui/bookings/BookingMapper.kt 60.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14778      +/-   ##
============================================
- Coverage     38.06%   38.03%   -0.04%     
- Complexity    10020    10024       +4     
============================================
  Files          2125     2125              
  Lines        119772   119928     +156     
  Branches      16314    16357      +43     
============================================
+ Hits          45589    45609      +20     
- Misses        69586    69712     +126     
- Partials       4597     4607      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AdamGrzybkowski AdamGrzybkowski force-pushed the issue/WOOMOB-1516_attendance_status branch from 02ac4c1 to 8b2f7dd Compare October 20, 2025 09:29
@AdamGrzybkowski AdamGrzybkowski marked this pull request as ready for review October 20, 2025 09:30
@JorgeMucientes JorgeMucientes self-assigned this Oct 20, 2025
@AdamGrzybkowski AdamGrzybkowski force-pushed the issue/WOOMOB-1516_attendance_status branch from 71bf4f8 to d4e83cc Compare October 20, 2025 13:43
Copy link
Contributor

@JorgeMucientes JorgeMucientes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @AdamGrzybkowski 🥇

I'm pre-approving the PR as code looks good and works well. About how to deal with the cancelled state we can either wait to merge this or handle it in a different PR once we discuss and decide how to proceed. I'll leave it up to you.

@AdamGrzybkowski
Copy link
Contributor Author

I will merge and we can update later as this PR adds more than just displaying a badge.

@AdamGrzybkowski AdamGrzybkowski merged commit 63ffe80 into trunk Oct 21, 2025
16 checks passed
@AdamGrzybkowski AdamGrzybkowski deleted the issue/WOOMOB-1516_attendance_status branch October 21, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants